package com.globant.dao;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.database.sqlite.SQLiteDatabase.CursorFactory;

public class PlaceSQLHelper extends SQLiteOpenHelper {

	private String sqlCreate = "CREATE TABLE PLACES " +
            "(_id INTEGER PRIMARY KEY AUTOINCREMENT, " +
            " name TEXT, " +
            " description TEXT, " +
            " latitude NUMERIC, " +
            " longitude NUMERIC)";
	
	public PlaceSQLHelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}
	
	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(sqlCreate);

	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS PLACES");
		db.execSQL(sqlCreate);	
	}

}
